

#!/bin/bash

#Nomes dos nos
NomesNos=("node1" "node2" "node3" "node4" "node5" "node6" "node7" "node8" "node9" "node10" "node11" "node12" "node15" "node16" "node17" "node18" "node19" "frontend")

#Nivel superior
ssh ${NomesNos[0]} "./NivelSup 22000 saida1.txt &" &
sleep 1

#Nivel intermediario 2
ssh ${NomesNos[1]} "./NivelInt2 node1 22000 22001 saida2.txt &" &
ssh ${NomesNos[2]} "./NivelInt2 node1 22000 22002 saida3.txt &" &
sleep 1

#Nivel intermediario 1
ssh ${NomesNos[3]} "./NivelInt1 node2 22001 22003 saida4.txt &" &
ssh ${NomesNos[4]} "./NivelInt1 node2 22001 22004 saida5.txt &" &
ssh ${NomesNos[5]} "./NivelInt1 node3 22002 22005 saida6.txt &" &
ssh ${NomesNos[6]} "./NivelInt1 node3 22002 22006 saida7.txt &" &
sleep 1

#Nivel inferior
ssh ${NomesNos[7]} "./NivelInf node4 22003 saida8.txt &" &
ssh ${NomesNos[8]} "./NivelInf node4 22003 saida9.txt &" &
ssh ${NomesNos[9]} "./NivelInf node5 22004 saida10.txt &" &
ssh ${NomesNos[10]} "./NivelInf node5 22004 saida11.txt &" &
ssh ${NomesNos[11]} "./NivelInf node6 22005 saida12.txt &" &
ssh ${NomesNos[12]} "./NivelInf node6 22005 saida13.txt &" &
ssh ${NomesNos[13]} "./NivelInf node7 22006 saida14.txt &" &
ssh ${NomesNos[14]} "./NivelInf node7 22006 saida15.txt &" &
sleep 1
